<!--
 * @Author: 吴竹叶 2107206923@qq.com
 * @Date: 2023-10-07 17:58:45
 * @LastEditors: 吴竹叶 2107206923@qq.com
 * @LastEditTime: 2023-11-01 13:43:59
 * @FilePath: \BZ_JT_AnQuanHuanBaoGuanLiApp\src\views\staging\commom\personnel\details.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<!--
 * @Author: 吴竹叶 2107206923@qq.com
 * @Date: 2023-10-07 17:58:45
 * @LastEditors: 吴竹叶 2107206923@qq.com
 * @LastEditTime: 2023-11-01 13:43:54
 * @FilePath: \BZ_JT_AnQuanHuanBaoGuanLiApp\src\views\staging\commom\personnel\details.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
  <div class="common-details">
    <customDetailsTopbar flag :title="`${active}详情页`" @back="back" />
    <div class="infoWarp listInner">
      <component :is="currentComponent" :company-id="companyId" />
    </div>
  </div>
</template>
<script>
import safeInfo from './components/safety/infoDetail.vue'
import environmentInfo from './components/environment/infoDetail.vue'
import FireFightingComponent from './components/fireFighting/infoDetail.vue'
import EnergySourcesComponent from './components/energySources/infoDetail.vue'
import CustomDetailsTopbar from '@/components/globals/custom-details-topbar.vue'

export default {
  components: {
    CustomDetailsTopbar,
    safeInfo,
    environmentInfo,
    FireFightingComponent,
    EnergySourcesComponent
  },
  data() {
    return {
      currentComponent: '',
      list: [
        {
          key: '安全生产',
          value: 'safeInfo'
        },
        {
          key: '环保管理',
          value: 'environmentInfo'
        },
        {
          label: '消防信息',
          key: '消防管理',
          value: 'FireFightingComponent'
        },
        {
          label: '能源信息',
          key: '能源管理',
          value: 'EnergySourcesComponent'
        }
      ],
      companyId: '',
      current: '',
      active: ''
    }
  },
  created() {
    const { current, companyId, active } = this.$route.query
    this.companyId = companyId || ''
    this.current = current || ''
    this.active = active ? active === '专家库' ? '专家' : active : ''
  },
  mounted() {
    this.list = this.list.filter((v) => {
      return v.key.indexOf(this.current) > -1
    })
    this.currentComponent = this.list[0].value
  },
  methods: {
    // tag标签页切换
    tagChange(tagArg) {
      this.list.map((v) => {
        if (v.label === tagArg.active) {
          this.currentComponent = v.value
        }
      })
    },
    back() {
      this.$router.replace({
        path: '/staging/personnel',
        query: this.$route.query
      })
    }
  }
}
</script>
<style lang="scss" scoped>
.infoWarp {
  position: absolute;
  top: 90px;
  right: 0;
  left: 0;
  bottom: 0;
  overflow-y: auto;
}
</style>
